package no.sachmuld.methodcombination.demo;

import no.sachmuld.methodcombination.api.MethodInvocation;

import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import java.io.IOException;

/**
 *
 */
public class ForwardFilterBehaviour extends FilterBehaviour {

    private String path;

    public ForwardFilterBehaviour(String path) {
        this.path = path;
    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, MethodInvocation<Void> methodInvocation) throws IOException, ServletException {

        request.getRequestDispatcher(path).forward(request, response);

    }
}
